
var  vm = new Vue({
    el:'#evaluation',
    data:{
        loading: true,
        user_id:'',
        user_name:'',
        city:'',
        web_token:'',
        lists:[],
        type:1,
        page_no:1,
        paginate:'',
        nodata:'',
        url:oss_url
    },
    methods:{
        // 收到评价
        getList:function (index) {
            this.loading    = true;
            if (index == 1){
                this.type    = 1;
                this.page_no = 1;
            }
            if (index == 2){
                this.type    = 2;
                this.page_no = 1;
            }
            if (index == 3){
                this.type    = 3;
                this.page_no = 1;
            }
            var url = '/userweb/my/comment';
            var data = {
                id:      this.user_id,
                type:    this.type,
                page:    this.page_no
            };
            this.$http.post(url, data, {
                emulateJSON: true
            }).then(function (res) {
                if (res.data.status == 200) {
                    this.lists      = res.data.comment.data;
                    this.paginate   = res.data.paginate;
                    for (var i=0;i<this.lists.length;i++){
                        this.lists[i]['image']  = this.url+ this.lists[i]['image'];
                        this.lists[i]['star']   = star(this.lists[i]['star']);
                    }
                }
                if (this.lists.length==0){
                    $('#noData').html(this.nodata);
                }else {
                    $('#noData').html("");
                }
                /*var _this = this;
                setTimeout(function () {
                    _this.loading = false;
                }, 300);*/
                this.loading = false;
            }, function (res) {

            });
        }
    },
    mounted: function () {
        this.nodata += '<div class="my_no-data">';
        this.nodata += '<div class="no_data_tip">';
        this.nodata += '<img src="/image/userweb/slicesImg/no-data.png" alt="">';
        this.nodata += '<div class="no-data-text">';
        this.nodata += '<div class="title_zh">暂无数据</div>';
        this.nodata += '<div class="title_en">No data</div>';
        this.nodata += '</div>';
        this.nodata += '</div>';
        this.nodata += '</div>';
        this.user_id        = localStorage.getItem('user_id');
        this.user_name      = localStorage.getItem('user_name');
        this.city           = localStorage.getItem('city');
        this.web_token      = localStorage.getItem('web_token');
        if (!this.user_id ){
            location.href = "/userweb/index/login.html";
        }
        this.getList();
    }
});
function AjaxPage(page) {
    vm.page_no = page;
    vm.getList();
}
function jump(){
    var page = $("#page_no").val();
    vm.page_no = page;
    vm.getList();
}